﻿using System;

namespace YArchitech.MEP.Electric.CableLay
{
	public class CableListData
	{
		public CableListData()
		{
			this.CableNum = string.Empty;
			this.StartNum = string.Empty;
			this.EndNum = string.Empty;
			this.CableModel = string.Empty;
			this.CableSpec = string.Empty;
			this.Length = string.Empty;
			this.LayPath = string.Empty;
			this.LayPathIDs = string.Empty;
			this.Remark = string.Empty;
			this.SheetID = -1;
			this.Row = -1;
		}

		public string CableNum { get; set; }

		public string StartNum { get; set; }

		public string EndNum { get; set; }

		public string CableModel { get; set; }

		public string CableSpec { get; set; }

		public string Length { get; set; }

		public string LayPath { get; set; }

		public string LayPathIDs { get; set; }

		public string Remark { get; set; }

		public int SheetID { get; set; }

		public int Row { get; set; }

		public override bool Equals(object obj)
		{
			if (obj == null)
			{
				return false;
			}
			CableListData cableListData = obj as CableListData;
			return this.CableNum == cableListData.CableNum;
		}

		public bool IsValid()
		{
			return !string.IsNullOrWhiteSpace(this.CableNum) && !string.IsNullOrWhiteSpace(this.StartNum) && !string.IsNullOrWhiteSpace(this.EndNum) && !string.IsNullOrWhiteSpace(this.CableModel) && !string.IsNullOrWhiteSpace(this.CableSpec);
		}

		public object this[string fieldName]
		{
			get
			{
				if ("CableNum" == fieldName)
				{
					return this.CableNum;
				}
				if ("StartNum" == fieldName)
				{
					return this.StartNum;
				}
				if ("EndNum" == fieldName)
				{
					return this.EndNum;
				}
				if ("CableModel" == fieldName)
				{
					return this.CableModel;
				}
				if ("CableSpec" == fieldName)
				{
					return this.CableSpec;
				}
				if ("Length" == fieldName)
				{
					return this.Length;
				}
				if ("LayPath" == fieldName)
				{
					return this.LayPath;
				}
				if ("Remark" == fieldName)
				{
					return this.Remark;
				}
				return null;
			}
			set
			{
				if ("CableNum" == fieldName)
				{
					this.CableNum = Convert.ToString(value);
				}
				if ("StartNum" == fieldName)
				{
					this.StartNum = Convert.ToString(value);
				}
				if ("EndNum" == fieldName)
				{
					this.EndNum = Convert.ToString(value);
				}
				if ("CableModel" == fieldName)
				{
					this.CableModel = Convert.ToString(value);
				}
				if ("CableSpec" == fieldName)
				{
					this.CableSpec = Convert.ToString(value);
				}
				if ("Length" == fieldName)
				{
					this.Length = Convert.ToString(value);
				}
				if ("LayPath" == fieldName)
				{
					this.LayPath = Convert.ToString(value);
				}
				if ("Remark" == fieldName)
				{
					this.Remark = Convert.ToString(value);
				}
			}
		}

		public bool IsMatch(string fieldName, string value)
		{
			if ("CableNum" == fieldName)
			{
				return value == this.CableNum;
			}
			if ("StartNum" == fieldName)
			{
				return value == this.StartNum;
			}
			if ("EndNum" == fieldName)
			{
				return value == this.EndNum;
			}
			if ("CableModel" == fieldName)
			{
				return value == this.CableModel;
			}
			if ("CableSpec" == fieldName)
			{
				return value == this.CableSpec;
			}
			if ("Length" == fieldName)
			{
				return value == this.Length;
			}
			if ("LayPath" == fieldName)
			{
				return value == this.LayPath;
			}
			return "Remark" == fieldName && value == this.Remark;
		}

		public bool IsContains(string fieldName, string value)
		{
			if ("CableNum" == fieldName)
			{
				return this.CableNum.Contains(value);
			}
			if ("StartNum" == fieldName)
			{
				return this.StartNum.Contains(value);
			}
			if ("EndNum" == fieldName)
			{
				return this.EndNum.Contains(value);
			}
			if ("CableModel" == fieldName)
			{
				return this.CableModel.Contains(value);
			}
			if ("CableSpec" == fieldName)
			{
				return this.CableSpec.Contains(value);
			}
			if ("Length" == fieldName)
			{
				return this.Length.Contains(value);
			}
			if ("LayPath" == fieldName)
			{
				return this.LayPath.Contains(value);
			}
			return "Remark" == fieldName && this.Remark.Contains(value);
		}
	}
}
